package org.pub.app.lunch;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Handler;
import android.os.Message;
import android.widget.Toast;

public class ProgressShowz {
	public Activity act;
	public String errorMsg = "";

	public ProgressShowz() {
	}

	public ProgressShowz(Activity tmpact) {
		act = tmpact;
	}

	public static ProgressDialog bloadingDialog; // Loading Dialog
	public Handler mHandler = new Handler() {
		public void handleMessage(Message msg) {
			bloadingDialog.dismiss();
			switch (msg.what) { // 메시지 처리
			case 100:
				break;
			case 101: // 네트웤에러
				Toast.makeText(act.getApplicationContext(), "R.string.network_puse", Toast.LENGTH_SHORT).show();
				break;
			case 102: // 네트웤 장비 에러
				Toast.makeText(act.getApplicationContext(), "R.string.network_error", Toast.LENGTH_SHORT).show();
				break;
			case 103:
				Toast.makeText(act.getApplicationContext(), errorMsg, Toast.LENGTH_SHORT).show();
				break;
			}
		}
	};

	public void showDialogBar() {
		bloadingDialog = ProgressDialog.show(act, "", "Please wait...", false, true);
		bloadingDialog.setCancelable(true);
		bloadingDialog.setOnCancelListener(new ProgressDialog.OnCancelListener() {

			public void onCancel(DialogInterface dialog) {
				// TODO Auto-generated method stub
				bloadingDialog.cancel();
			}
		});
	}
}
